using System.Text.Json.Serialization;

namespace Sage.CloudStorage.Qiniu.Models
{
    /// <summary>
    /// CDN日志列表查询结果
    /// </summary>
    public class CdnLogListResult
    {
        /// <summary>
        /// 状态码
        /// </summary>
        [JsonPropertyName("code")]
        public int Code { get; set; }

        /// <summary>
        /// 错误信息
        /// </summary>
        [JsonPropertyName("error")]
        public string? Error { get; set; }

        /// <summary>
        /// 日志数据（域名为键，日志列表为值）
        /// </summary>
        [JsonPropertyName("data")]
        public Dictionary<string, List<LogData>>? Data { get; set; }
    }

    /// <summary>
    /// 日志数据
    /// </summary>
    public class LogData
    {
        /// <summary>
        /// 文件名
        /// </summary>
        [JsonPropertyName("name")]
        public string? Name { get; set; }

        /// <summary>
        /// 文件大小，单位为字节
        /// </summary>
        [JsonPropertyName("size")]
        public long Size { get; set; }

        /// <summary>
        /// 文件修改时间，Unix时间戳
        /// </summary>
        [JsonPropertyName("mtime")]
        public long Mtime { get; set; }

        /// <summary>
        /// 日志下载链接
        /// </summary>
        [JsonPropertyName("url")]
        public string? Url { get; set; }
    }
}